<!doctype html>
<html>
<head>
	<title>Analyzer Example</title>
	<!-- -->
	<script src="../../../../enyo/enyo.js" type="text/javascript"></script>
	<!-- -->
	<script src="../../utils/string.js" type="text/javascript"></script>
	<script src="../../analyzer/package.js" type="text/javascript"></script>
	<script src="../Processor.js" type="text/javascript"></script>
	<style>
		i {
			color: Blue;
		}
		group {
			color: Orange;
		}
	</style>
</head>
<body>
	<script id="test">
		//* @protected
		//* a function
		function doh(x, y, z) {
		}
		//* @public
		//* a conditional
		if (true) {
			var a = 3;
		}else{
			snarg;
		}
		//* some declarations
		var x, y, z;
		//* @protected
		var foo = {
			a: 3,
			b: "flarn",
			c: enyo.nop()
		};
		if (false) {
			gump();
			enyo.kind({
				foo: 3,
				gah: {
					foo: 3
				},
				spaz: function(a, b) {
					// nork
				}
			});
		};
	</script>
	<script>
		var _dump = function(inNodes) {
			for (var i=0, n; n=inNodes[i]; i++){
				if (n.comment) {
					document.write("<i>" + n.comment + "</i><br />");
				}
				if (n.group) {
					document.write("<group>" + n.group + "</group>: ");
				}
				document.write(n.kind);
				if (n.token) {
					document.write(" [<b>" + n.token + "</b>]");
				}
				document.write("<br>");
				if (n.children) {
					document.write("<blockquote>");
					_dump(n.children);
					document.write("</blockquote>");
				}
			}
		};
		var dump = function(inNodes) {
			_dump(inNodes);
			document.write("<hr />");
		};
	</script>
	<script>
		var s = document.getElementById("test");
		console.log(s.text);
		//
		var tokens = new enyo.lexer.Js(s.text);
		console.dir(tokens.r);
		//
		var nodes = new enyo.parser.Code(tokens).nodes;
		console.dir(nodes);
		dump(nodes);
		//
		var nodes = new enyo.DocParser(nodes);
		console.dir(nodes);
		dump(nodes);
	</script>
</body>
</html>
